-- Localized Functions for the Asian Version; I am too lazy to exclude the localizations in a more separate way!
-- Outsorced functions:
-- _Yell, _Emote, _Enter_Combat

if ( GetLocale() == "zhTW" or GetLocale() == "koKR" or GetLocale() == "zhCN" ) then

-- === defined by instance === --

	function NECB_PvE_CodeInit(noreg)

		if (not noreg and not NECB_no_PvE_code) then
			return;
		end
		NECB_no_PvE_code = false;

	 if (GetRealZoneText() == NECB_BlackwingLair and not noreg) then

		function NECB_PvE_Yell(arg1, arg2)
			if (arg2 == NECB_PvE_Vars["NEFARIAN_NAME"]) then
	
				if (string.find(arg1, NECB_PvE_Vars["NEFARIAN_SHAMAN_CALL"])) then
					CEnemyCastBar_Control(NECB_PvE_Vars["CLASS_SHAMANS"], NECB_PvE_Vars["NEF_CALLS"], "pve");
				elseif (string.find(arg1, NECB_PvE_Vars["NEFARIAN_DRUID_CALL"])) then
					CEnemyCastBar_Control(NECB_PvE_Vars["CLASS_DRUIDS"], NECB_PvE_Vars["NEF_CALLS"], "pve");
				elseif (string.find(arg1, NECB_PvE_Vars["NEFARIAN_WARLOCK_CALL"])) then
					CEnemyCastBar_Control(NECB_PvE_Vars["CLASS_WARLOCKS"], NECB_PvE_Vars["NEF_CALLS"], "pve");
				elseif (string.find(arg1, NECB_PvE_Vars["NEFARIAN_PRIEST_CALL"])) then
					CEnemyCastBar_Control(NECB_PvE_Vars["CLASS_PRIESTS"], NECB_PvE_Vars["NEF_CALLS"], "pve");
				elseif (string.find(arg1, NECB_PvE_Vars["NEFARIAN_HUNTER_CALL"])) then
					CEnemyCastBar_Control(NECB_PvE_Vars["CLASS_HUNTERS"], NECB_PvE_Vars["NEF_CALLS"], "pve");
				elseif (string.find(arg1, NECB_PvE_Vars["NEFARIAN_WARRIOR_CALL"])) then
					CEnemyCastBar_Control(NECB_PvE_Vars["CLASS_WARRIORS"], NECB_PvE_Vars["NEF_CALLS"], "pve");
				elseif (string.find(arg1, NECB_PvE_Vars["NEFARIAN_ROGUE_CALL"])) then
					CEnemyCastBar_Control(NECB_PvE_Vars["CLASS_ROGUES"], NECB_PvE_Vars["NEF_CALLS"], "pve");
				elseif (string.find(arg1, NECB_PvE_Vars["NEFARIAN_PALADIN_CALL"])) then
					CEnemyCastBar_Control(NECB_PvE_Vars["CLASS_PALADINS"], NECB_PvE_Vars["NEF_CALLS"], "pve");
				elseif (string.find(arg1, NECB_PvE_Vars["NEFARIAN_MAGE_CALL"])) then
					CEnemyCastBar_Control(NECB_PvE_Vars["CLASS_MAGES"], NECB_PvE_Vars["NEF_CALLS"], "pve");
				elseif (string.find(arg1, NECB_PvE_Vars["NEFARIAN_LAND"])) then
					CEnemyCastBar_Control(NECB_PvE_Vars["NEFARIAN_NAME"], NECB_PvE_Vars["LANDING"], "pve");
				end
	
			elseif (arg2 == NECB_PvE_Vars["NEFARIUS_NAME"]) then
	
				if (string.find(arg1, NECB_PvE_Vars["NEFARIAN_STARTING"])) then	
					CEnemyCastBar_Control(NECB_PvE_Vars["NEFARIAN_NAME"], NECB_PvE_Vars["MOB_SPAWN"], "pve");
				end

			elseif (string.find(arg2, NECB_PvE_Vars["GRETHOK_NAME_PAT"]) ) then
	
				if (string.find(arg1, NECB_PvE_Vars["RAZORGORE_CALL"])) then	
					CEnemyCastBar_Control(NECB_PvE_Vars["RAZORGORE_NAME"], NECB_PvE_Vars["MOB_SPAWN_45SEC"], "pve");
				end
			end
		end
		function NECB_PvE_Emote(arg1, arg2)

			if (arg2 == NECB_PvE_Vars["FLAMEGOR_NAME"]) then
	
				if (string.find(arg1, NECB_PvE_Vars["FLAMEGOR_FRENZY"])) then
	
					CEnemyCastBar_Control(NECB_PvE_Vars["FLAMEGOR_NAME"], NECB_PvE_Vars["FRENZY_CD"], "pve");
				end
	
			elseif (arg2 == NECB_PvE_Vars["CHROMAGGUS"]) then
	
				if (string.find(arg1, NECB_PvE_Vars["CHROMAGGUS_FRENZY"])) then
	
					CEnemyCastBar_Control(NECB_PvE_Vars["CHROMAGGUS"], NECB_PvE_Vars["KILLING_FRENZY"], "pve");
				end
			end
		end
		function NECB_PvE_EnterCombat(targetmob)
			if (targetmob == NECB_PvE_Vars["FIREMAW_NAME"] or targetmob == NECB_PvE_Vars["FLAMEGOR_NAME"] or targetmob == NECB_PvE_Vars["EBONROC_NAME"]) then
				CEnemyCastBar_Control(targetmob, NECB_PvE_Vars["FIRST_WINGBUFFET"], "engage");
			end
		end

	 elseif (GetRealZoneText() == NECB_MoltenCore and not noreg) then

		function NECB_PvE_Yell(arg1, arg2)
	
			if (arg2 == NECB_PvE_Vars["RAGNAROS_NAME"]) then
	
				if (string.find(arg1, NECB_PvE_Vars["RAGNAROS_STARTING"])) then	
					CEnemyCastBar_Control(NECB_PvE_Vars["RAGNAROS_NAME"], NECB_PvE_Vars["SUBMERGE"], "pve");
				elseif (string.find(arg1, NECB_PvE_Vars["RAGNAROS_KICKER"])) then	
					CEnemyCastBar_Control(NECB_PvE_Vars["RAGNAROS_NAME"], NECB_PvE_Vars["KNOCKBACK"], "pve");
				elseif (string.find(arg1, NECB_PvE_Vars["RAGNAROS_SONS"])) then
					CEnemyCastBar_Control(NECB_PvE_Vars["RAGNAROS_NAME"], NECB_PvE_Vars["SONS_OF_FLAME"], "pve");
				end
			end
		end
		function NECB_PvE_Emote() end
		function NECB_PvE_EnterCombat() end


	 elseif (GetRealZoneText() == NECB_AhnQiraj and not noreg) then

		function NECB_PvE_Yell(arg1, arg2)

			if (string.find(arg2, NECB_PvE_Vars["SARTURA_NAME_PAT"]) ) then
	
				if (string.find(arg1, NECB_PvE_Vars["SARTURA_CALL"])) then
	
					CEnemyCastBar_Control(NECB_PvE_Vars["SARTURA_NAME"], NECB_PvE_Vars["ENRAGED_MODE2"], "pve");
				end
			end
		end
		function NECB_PvE_Emote(arg1, arg2)
	
			if (string.find(arg2, NECB_PvE_Vars["SARTURA_NAME_PAT"]) ) then
	
				if (string.find(arg1, NECB_PvE_Vars["SARTURA_CRAZY"])) then
	
					CEnemyCastBar_DelBar(NECB_PvE_Vars["ENRAGED_MODE2"]);
					CEnemyCastBar_Control(NECB_PvE_Vars["SARTURA_NAME"], NECB_PvE_Vars["ENTER_ENRAGED_MODE"], "pve");

				end
	
			elseif (string.find(arg2, NECB_PvE_Vars["HUHURAN_NAME_PAT"]) ) then
	
				if (string.find(arg1, NECB_PvE_Vars["FLAMEGOR_FRENZY"])) then
	
					CEnemyCastBar_Control(NECB_PvE_Vars["HUHURAN_NAME"], NECB_PvE_Vars["FRENZY_CD"], "pve");
	
				elseif (string.find(arg1, NECB_PvE_Vars["HUHURAN_CRAZY"])) then
	
					CEnemyCastBar_DelBar(NECB_PvE_Vars["BERSERK_MODE"]);
					CEnemyCastBar_Control(NECB_PvE_Vars["HUHURAN_NAME"], NECB_PvE_Vars["ENTER_BERSERK_MODE"], "pve");
				end
	
			elseif (string.find(NECB_PvE_Vars["CTHUN_NAME1"], arg2) ) then
	
				if (string.find(arg1, NECB_PvE_Vars["CTHUN_WEAKENED"])) then
	
					CEnemyCastBar_Control(NECB_PvE_Vars["CTHUN_NAME2"], NECB_PvE_Vars["WEAKENED"], "pve", "true");
				end
			end
		end
		function NECB_PvE_EnterCombat(targetmob)

			if (string.find (targetmob, NECB_PvE_Vars["YAUJ_NAME_PAT"]) or string.find (targetmob, NECB_PvE_Vars["KRI_NAME_PAT"]) or targetmob == NECB_PvE_Vars["VEM_NAME"] ) then

				CEnemyCastBar_Control(NECB_PvE_Vars["DETECTED_NAME"], "Boss incoming", "engage"); -- to allow the (protected) fear, "Boss incoming".t = 0 ^^

			elseif (string.find (targetmob, NECB_PvE_Vars["HUHURAN_NAME"]) ) then

				CEnemyCastBar_Control(NECB_PvE_Vars["HUHURAN_NAME"], NECB_PvE_Vars["BERSERK_MODE"], "engage");

			elseif (targetmob == NECB_PvE_Vars["OURO_NAME"] ) then

				CEnemyCastBar_Control(NECB_PvE_Vars["OURO_NAME"], NECB_PvE_Vars["POSSIBLE_OURO_SUBMERGE"], "engage");

			elseif (string.find (targetmob, NECB_PvE_Vars["CTHUN_NAME1"]) ) then

				CEnemyCastBar_Control(NECB_PvE_Vars["CTHUN_NAME2"], NECB_PvE_Vars["FIRST_DARK_GLARE"], "engage");
				CEnemyCastBar_Control(NECB_PvE_Vars["CTHUN_NAME2"], NECB_PvE_Vars["SMALL_EYE_P1"], "pve");

			elseif ( (string.find (targetmob, NECB_PvE_Vars["VEKLOR_NAME"]) or string.find (targetmob, NECB_PvE_Vars["VEKNILASH_NAME"]) ) ) then

				CEnemyCastBar_Control(NECB_PvE_Vars["TWINS_NAME"], NECB_PvE_Vars["ENRAGED_MODE2"], "engage");
				CEnemyCastBar_Control(NECB_PvE_Vars["TWINS_NAME"], NECB_PvE_Vars["TWIN_TELEPORT"], "pve");
			end
		end

	 elseif (GetRealZoneText() == NECB_ZulGurub and not noreg) then

		function NECB_PvE_Yell(arg1, arg2)
	
			if (arg2 == NECB_PvE_Vars["HAKKAR_NAME"]) then
	
				if (string.find(arg1, NECB_PvE_Vars["HAKKAR_YELL"])) then
	
					CEnemyCastBar_Control(NECB_PvE_Vars["HAKKAR_NAME"], NECB_PvE_Vars["ENRAGED_MODE2"], "pve");
					CEnemyCastBar_Control(NECB_PvE_Vars["HAKKAR_NAME"], NECB_PvE_Vars["BLOOD_SIPHON"], "pve", nil, "CHAT_MSG_SPELL_PERIODIC_CREATURE_BUFFS");
				end
			end
		end
		function NECB_PvE_Emote() end
		function NECB_PvE_EnterCombat() end

	 elseif (GetRealZoneText() == NECB_Naxxramas and not noreg) then

		function NECB_PvE_Yell(arg1, arg2)
	
			if (arg2 == NECB_PvE_Vars["PATCHWERK_NAME"]) then
	
				if (string.find(arg1, NECB_PvE_Vars["PATCHWERK_NAME"]) ) then
	
					CEnemyCastBar_Control(NECB_PvE_Vars["PATCHWERK_NAME"], NECB_PvE_Vars["ENRAGED_MODE1"], "pve");
				end
	
			elseif (string.find(arg2, NECB_PvE_Vars["RAZUVIOUS_NAME_PAT"]) ) then
	
					CEnemyCastBar_Control(NECB_PvE_Vars["RAZUVIOUS_NAME"], NECB_PvE_Vars["DISRUPTING_SHOUT"], "engage");
					NECBEvents1:RegisterEvent("CHAT_MSG_SPELL_CREATURE_VS_PARTY_DAMAGE");
					NECBEvents1:RegisterEvent("CHAT_MSG_SPELL_CREATURE_VS_SELF_DAMAGE");
	
			elseif (string.find(arg2, NECB_PvE_Vars["FAERLINA_NAME_PAT"]) ) then
	
				if (string.find(arg1, NECB_PvE_Vars["FAER_YELL1"]) or string.find(arg1, NECB_PvE_Vars["FAER_YELL2"]) or string.find(arg1, NECB_PvE_Vars["FAER_YELL3"]) or string.find(arg1, NECB_PvE_Vars["FAER_YELL4"]) ) then
	
					CEnemyCastBar_Control(NECB_PvE_Vars["FAERLINA_NAME"], NECB_PvE_Vars["ENRAGE"], "pve");
				end
	
			elseif (string.find(arg2, NECB_PvE_Vars["GOTHIK_NAME_PAT"]) ) then
	
				if (string.find(arg1, NECB_PvE_Vars["GOTHIK_YELL"]) ) then

					CEnemyCastBar_Control(NECB_PvE_Vars["GOTHIK_NAME"], NECB_PvE_Vars["COMES_DOWN"], "pve");
					CEnemyCastBar_Control(NECB_PvE_Vars["GOTHIK_NAME"], NECB_PvE_Vars["1ST_TRAINEES_INCOME"], "pve");
					CEnemyCastBar_Control(NECB_PvE_Vars["GOTHIK_NAME"], NECB_PvE_Vars["1ST_DK_INCOME"], "pve");
					CEnemyCastBar_Control(NECB_PvE_Vars["GOTHIK_NAME"], NECB_PvE_Vars["1ST_RIDER_INCOME"], "pve");
				end
	
			elseif (arg2 == NECB_PvE_Vars["ANUB_NAME"]) then
	
				if (string.find(arg1, NECB_PvE_Vars["ANUB_YELL1"]) or string.find(arg1, NECB_PvE_Vars["ANUB_YELL2"]) or string.find(arg1, NECB_PvE_Vars["ANUB_YELL3"]) ) then
	
					CEnemyCastBar_Control(NECB_PvE_Vars["ANUB_NAME"], NECB_PvE_Vars["FIRST_LOCUST_SWARM"], "pve");
				end
	
			elseif (string.find(arg2, NECB_PvE_Vars["NOTH_NAME_PAT"]) ) then
	
					CEnemyCastBar_Control(NECB_PvE_Vars["NOTH_NAME"], NECB_PvE_Vars["FIRST_TELEPORT"], "engage");
	
			elseif (string.find(arg2, NECB_PvE_Vars["HEIGAN_NAME_PAT"]) ) then
	
				if (string.find(arg1, NECB_PvE_Vars["HEIGAN_YELL1"]) or string.find(arg1, NECB_PvE_Vars["HEIGAN_YELL2"]) or string.find(arg1, NECB_PvE_Vars["HEIGAN_YELL3"]) ) then
	
					CEnemyCastBar_Control(NECB_PvE_Vars["HEIGAN_NAME"], NECB_PvE_Vars["TELEPORT_CD"], "pve");
	
				elseif (string.find(arg1, NECB_PvE_Vars["HEIGAN_TELEPORT_YELL"]) ) then
	
					CEnemyCastBar_Control(NECB_PvE_Vars["HEIGAN_NAME"], NECB_PvE_Vars["ON_PLATFORM"], "pve");
				end
			end
		end
		function NECB_PvE_Emote() end
		function NECB_PvE_EnterCombat(targetmob)

			if (targetmob == NECB_PvE_Vars["GLUTH_NAME"] ) then

				CEnemyCastBar_Control(NECB_PvE_Vars["GLUTH_NAME"], NECB_PvE_Vars["DECIMATE"], "engage");
				NECBEvents1:RegisterEvent("CHAT_MSG_SPELL_CREATURE_VS_PARTY_DAMAGE");
				NECBEvents1:RegisterEvent("CHAT_MSG_SPELL_CREATURE_VS_SELF_DAMAGE");

			elseif (targetmob == NECB_PvE_Vars["MAEXXAN_NAME"] ) then

				CEnemyCastBar_Control(NECB_PvE_Vars["MAEXXAN_NAME"], NECB_PvE_Vars["WEB_SPRAY"], "engage");

			elseif (targetmob == NECB_PvE_Vars["LOATHEB_NAME"] ) then

				CEnemyCastBar_Control(NECB_PvE_Vars["LOATHEB_NAME"], NECB_PvE_Vars["15SEC_DOOM_CD"], "engage");
				CEnemyCastBar_Control(NECB_PvE_Vars["LOATHEB_NAME"], NECB_PvE_Vars["FIRST_INVITABLE_DOOM"], "pve");

			elseif (targetmob == NECB_PvE_Vars["SAPPHIRON_NAME"] ) then
	
				CEnemyCastBar_Control(targetmob, NECB_PvE_Vars["ENRAGED_MODE2"], "engage");
			end

		end

	 elseif (GetRealZoneText() == NECB_OnyxiaLair and not noreg) then
		function NECB_PvE_Yell() end
		function NECB_PvE_Emote(arg1, arg2)
	
			if (arg2 == NECB_PvE_Vars["ONYXIA_NAME"]) then
	
				if (string.find(arg1, NECB_PvE_Vars["ONY_DB"])) then
	
					CEnemyCastBar_Control(NECB_PvE_Vars["ONYXIA_NAME"], NECB_PvE_Vars["DEEP_BREATH"], "pve");
				end
			end
		end
		function NECB_PvE_EnterCombat() end

	 elseif (GetRealZoneText() == NECB_AhnQirajRuins and not noreg) then
		function NECB_PvE_Yell(arg1, arg2) end
		function NECB_PvE_Emote(arg1, arg2)

			if (arg2 == NECB_PvE_Vars["MOAM_NAME"]) then
	
				if (string.find(arg1, NECB_PvE_Vars["MOAM_STARTING"])) then
	
					CEnemyCastBar_Control(NECB_PvE_Vars["MOAM_NAME"], NECB_PvE_Vars["UNTIL_STONEFORM"], "pve");
				end
			end
		end
		function NECB_PvE_EnterCombat() end

	 else
		function NECB_PvE_Yell() end
		function NECB_PvE_Emote() end
		function NECB_PvE_EnterCombat() end
		NECB_no_PvE_code = true;

	 end


	 -- EXCEPTIONS:
	 --------------
	 if (GetRealZoneText() == NECB_Naxxramas and not noreg) then

		function CEnemyCastBar_Gfind_PvE(arg1, event)
			-- spell hits (Razuvious + others)
			local mob, spell, target, damage = string.match(arg1, CEnemyCastBar_SPELL_HITS);
			if (mob) then
				if (
					string.match(mob, NECB_PvE_Vars["RAZUVIOUS_NAME_PAT"])
					or mob == NECB_PvE_Vars["GLUTH_NAME"]
					) then
	
					if (NECB_SPELL_HITS_turnit) then
						CEnemyCastBar_Control(spell, mob, "casts", nil, event);
					else
						CEnemyCastBar_Control(mob, spell, "casts", nil, event);
					end
				end
				return;
			end
		end
	 else
		CEnemyCastBar_Gfind_PvE = nil;
	 end

	 -- C'Thun death (so far the only mob checked for)
	 if (GetRealZoneText() == NECB_AhnQiraj and not noreg) then

		function NECB_PvE_death(mob)
			if (mob == NECB_PvE_Vars["CTHUN_NAME1"]) then

				CEnemyCastBar_DelBar(NECB_PvE_Vars["DARK_GLARE"]);
				CEnemyCastBar_DelBar(NECB_PvE_Vars["SMALL_EYE_P1"]);
				CEnemyCastBar_Control(NECB_PvE_Vars["CTHUN_NAME2"], NECB_PvE_Vars["FIRST_SMALL_EYE_P2"], "pve");
			end
		end
	 else
		NECB_PvE_death = nil;
	 end

	end -- code init function end
	-----------------------------

end